/*
 * Copyright 2006 Mark Bakker <bakker.mark AT gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.gwt.vector.client.ui;

import com.google.gwt.vector.client.Vector;

public class VectorPanel extends VectorWidget {

  /**
   * This rectangle is used as a background to define set the actual size of this panel
   * in VML mode a panel is not used as a container where vector shapes can be drawn, so
   * the panel will grown when you add extra VectorWidgets to the panel. VML does also not
   * support clipping what will result that shapes can be and will be drawn outside the
   * defined panel width and height.
   */
  private Rectangle rectangle = new Rectangle(0, 0, 0 , 0);

  public VectorPanel(double width, double height) {
    super(Vector.createVectorGroup());
    add(rectangle);
    rectangle.setOpacity(0);
    rectangle.setStrokeOpacity(0);
    setDimension(width, height);
  }

  public void setDimension(double width, double height) {
    Vector.setDimension(getElement(), width, height);
    Vector.setGroupDimension(getElement(), width, height);
    rectangle.setDimension(width, height);
  }
}
